import request from '@/utils/request'

export default {
  getModelPipeList(searchModel) {
    return request({
      url: '/modelPipe/list',
      method: 'get',
      params: {
        pipeName: searchModel.pipeName,
        pageNo: searchModel.pageNo,
        pageSize: searchModel.pageSize
      }
    })
  },
  addModelPipe(modelPipe) {
    return request({
      url: '/modelPipe/add',
      method: 'post',
      data: modelPipe
    })
  },
  saveModelPipe(modelPipe) {
    if (modelPipe.id == null || modelPipe.id === undefined) {
      return this.addModelPipe(modelPipe)
    }
    return this.updateModelPipe(modelPipe)
  },
  updateModelPipe(modelPipe) {
    return request({
      url: '/modelPipe/update',
      method: 'put',
      data: modelPipe
    })
  },
  getModelPipeById(id) {
    return request({
      // url: '/modelPipe/' + id,
      url: `/modelPipe/${id}`,
      method: 'get'
    })
  },
  deleteModelPipeById(id) {
    return request({
      url: `/modelPipe/delete/${id}`,
      method: 'delete'
    })
  },
  getAllModelPipeList() {
    return request({
      url: '/modelPipe/all',
      method: 'get'
    })
  },
}
